load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
load("//tools:defaults.bzl", "http_server", "ng_project")

package(default_visibility = ["//visibility:public"])

ng_project(
    name = "router_activated_route_examples",
    srcs = glob(
        ["**/*.ts"],
    ),
    deps = [
        "//:node_modules/rxjs",
        "//:node_modules/zone.js",
        "//packages/core",
        "//packages/platform-browser",
        "//packages/router",
    ],
)

esbuild(
    name = "app_bundle",
    config = {
        "resolveExtensions": [".js"],
    },
    entry_point = ":main.ts",
    tsconfig = "//packages/examples:tsconfig_build",
    deps = [
        ":router_activated_route_examples",
        "//packages/examples:tsconfig_build",
    ],
)

http_server(
    name = "devserver",
    srcs = ["//packages/examples:index.html"],
    additional_root_paths = ["_main/packages/examples"],
    deps = [":app_bundle"],
)

filegroup(
    name = "files_for_docgen",
    srcs = glob([
        "**/*.ts",
    ]),
)
